package com.example.serviceconsumer.controller;

import com.example.common.api.HelloService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
public class HelloController {
    @Reference
    HelloService helloService;

    @ResponseBody
    @RequestMapping(value = "/hello", method = RequestMethod.GET)
    public String sayHello(String message) {
        System.out.println(helloService.toString());
        return helloService.sayHello(message);
    }
}
